<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="事务,分布式,缓存,CAP,BASE,">










<meta name="description" content="CAP和BASE理论CAPConsistency（一致性）Availability（可用性）Partition tolerance（分区容错性）CP / AP / CA BASEBA：基本可用，响应时间降低、功能损失(功能降级)S：软状态，节点数据之间同步数据存在时延E：最终一致性，各个节点的数据经过一段时间后，最终可以到达一致状态 SOA分布式事务解决方案基于XA协议的两阶段提交方案事务协调者">
<meta name="keywords" content="事务,分布式,缓存,CAP,BASE">
<meta property="og:type" content="article">
<meta property="og:title" content="分布式理论">
<meta property="og:url" content="http://koude.gitee.io/blog/2019/03/18/分布式事务/index.html">
<meta property="og:site_name" content="JavaKK">
<meta property="og:description" content="CAP和BASE理论CAPConsistency（一致性）Availability（可用性）Partition tolerance（分区容错性）CP / AP / CA BASEBA：基本可用，响应时间降低、功能损失(功能降级)S：软状态，节点数据之间同步数据存在时延E：最终一致性，各个节点的数据经过一段时间后，最终可以到达一致状态 SOA分布式事务解决方案基于XA协议的两阶段提交方案事务协调者">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://img2018.cnblogs.com/blog/1481291/201809/1481291-20180925142206124-913246424.png">
<meta property="og:image" content="https://img2018.cnblogs.com/blog/1481291/201809/1481291-20180925142304757-1498788186.png">
<meta property="og:updated_time" content="2019-03-28T09:09:49.268Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="分布式理论">
<meta name="twitter:description" content="CAP和BASE理论CAPConsistency（一致性）Availability（可用性）Partition tolerance（分区容错性）CP / AP / CA BASEBA：基本可用，响应时间降低、功能损失(功能降级)S：软状态，节点数据之间同步数据存在时延E：最终一致性，各个节点的数据经过一段时间后，最终可以到达一致状态 SOA分布式事务解决方案基于XA协议的两阶段提交方案事务协调者">
<meta name="twitter:image" content="https://img2018.cnblogs.com/blog/1481291/201809/1481291-20180925142206124-913246424.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://koude.gitee.io/blog/2019/03/18/分布式事务/">





  <title>分布式理论 | JavaKK</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">JavaKK</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">Welcome To My Blog</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://koude.gitee.io/blog/blog/2019/03/18/分布式事务/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="JavaKK">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="JavaKK">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">分布式理论</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-03-18T14:30:00+08:00">
                2019-03-18
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/分布式/" itemprop="url" rel="index">
                    <span itemprop="name">分布式</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <hr>
<h1 id="CAP和BASE理论"><a href="#CAP和BASE理论" class="headerlink" title="CAP和BASE理论"></a>CAP和BASE理论</h1><h2 id="CAP"><a href="#CAP" class="headerlink" title="CAP"></a>CAP</h2><p>Consistency（一致性）<br>Availability（可用性）<br>Partition tolerance（分区容错性）<br>CP / AP / CA</p>
<h2 id="BASE"><a href="#BASE" class="headerlink" title="BASE"></a>BASE</h2><p>BA：基本可用，响应时间降低、功能损失(功能降级)<br>S：软状态，节点数据之间同步数据存在时延<br>E：最终一致性，各个节点的数据经过一段时间后，最终可以到达一致状态</p>
<h1 id="SOA分布式事务解决方案"><a href="#SOA分布式事务解决方案" class="headerlink" title="SOA分布式事务解决方案"></a>SOA分布式事务解决方案</h1><h2 id="基于XA协议的两阶段提交方案"><a href="#基于XA协议的两阶段提交方案" class="headerlink" title="基于XA协议的两阶段提交方案"></a>基于XA协议的两阶段提交方案</h2><p>事务协调者向所有接入的本地事务发起提交命令，所有本地事务接受到命令之后，执行SQL并返回预执行结果，此时并不提交事务，事务协调者对所有结果判断全部成功之后，向本地事务发起确认提交命令，本地事务提交事务。<br>但是两阶段提交方案锁定资源时间长，对性能影响很大，基本不适合解决微服务事务问题。</p>
<h2 id="TCC方案"><a href="#TCC方案" class="headerlink" title="TCC方案"></a>TCC方案</h2><p>TCC方案在电商、金融领域落地较多。TCC方案其实是两阶段提交的一种改进。其将整个业务逻辑的每个分支显式的分成了Try、Confirm、Cancel三个操作。<br>对应用的侵入性强，实现难度较大</p>
<p>##基于消息的最终一致性方案<br>消息一致性方案是通过消息中间件保证上、下游应用数据操作的一致性。基本思路是将本地操作和发送消息放在一个事务中，保证本地操作和消息发送要么两者都成功或者都失败。下游应用向消息系统订阅该消息，收到消息后执行相应操作。</p>
<h2 id="GTS–分布式事务解决方案"><a href="#GTS–分布式事务解决方案" class="headerlink" title="GTS–分布式事务解决方案"></a>GTS–分布式事务解决方案</h2><h3 id="性能超强"><a href="#性能超强" class="headerlink" title="性能超强"></a>性能超强</h3><p>GTS通过大量创新，解决了事务ACID特性与高性能、高可用、低侵入不可兼得的问题。单事务分支的平均响应时间在2ms左右，3台服务器组成的集群可以支撑3万TPS以上的分布式事务请求。<br>应用侵入性极低</p>
<h3 id="GTS对业务低侵入"><a href="#GTS对业务低侵入" class="headerlink" title="GTS对业务低侵入"></a>GTS对业务低侵入</h3><p>业务代码最少只需要添加一行注解（@TxcTransaction）声明事务即可。业务与事务分离，将微服务从事务中解放出来，微服务关注于业务本身，不再需要考虑反向接口、幂等、回滚策略等复杂问题，极大降低了微服务开发的难度与工作量。</p>
<h3 id="完整解决方案"><a href="#完整解决方案" class="headerlink" title="完整解决方案"></a>完整解决方案</h3><p>GTS支持多种主流的服务框架，包括EDAS，Dubbo，Spring Cloud等。<br>有些情况下，应用需要调用第三方系统的接口，而第三方系统没有接入GTS。此时需要用到GTS的MT模式。GTS的MT模式可以等价于TCC模式，用户可以根据自身业务需求自定义每个事务阶段的具体行为。MT模式提供了更多的灵活性，可能性，以达到特殊场景下的自定义优化及特殊功能的实现。</p>
<h3 id="容错能力强"><a href="#容错能力强" class="headerlink" title="容错能力强"></a>容错能力强</h3><p>GTS解决了XA事务协调器单点问题，实现真正的高可用，可以保证各种异常情况下的严格数据一致</p>
<h2 id="LCN-SpringCloud"><a href="#LCN-SpringCloud" class="headerlink" title="LCN-SpringCloud"></a>LCN-SpringCloud</h2><h2 id="Atomikos"><a href="#Atomikos" class="headerlink" title="Atomikos"></a>Atomikos</h2><hr>
<h2 id="分布式缓存"><a href="#分布式缓存" class="headerlink" title="#分布式缓存"></a>#分布式缓存</h2><h2 id="Redis简介"><a href="#Redis简介" class="headerlink" title="Redis简介"></a>Redis简介</h2><h3 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h3><p>支持strings, hashes, lists, sets, sorted sets<br>string是很好的存储方式，用来做计数存储。sets用于建立索引库非常棒；</p>
<h3 id="主从复制"><a href="#主从复制" class="headerlink" title="主从复制"></a>主从复制</h3><p>在配置时，如果需要让CPU使用率最大化，可以配置Redis实例数对应CPU数, Redis实例数对应端口数(8核Cpu, 8个实例, 8个端口), 以提高并发。<br>数据写到master–&gt;master存储到slave的rdb中–&gt;slave加载rdb到内存。Master-slave下第一次同步是全传，后面是增量同步</p>
<h3 id="持久化"><a href="#持久化" class="headerlink" title="持久化"></a>持久化</h3><p>RDB（默认）：rdb是Redis DataBase缩写<br>AOF:Aof是Append-only file缩写<br>比较：<br>1、aof文件比rdb更新频率高，优先使用aof还原数据。<br>2、aof比rdb更安全也更大<br>3、rdb性能比aof好<br>4、如果两个都配了优先加载AOF</p>
<h3 id="Redis通信协议"><a href="#Redis通信协议" class="headerlink" title="Redis通信协议"></a>Redis通信协议</h3><p>RESP : redis客户端和服务端之前使用的一种通讯协议<br>RESP 的特点：实现简单、快速解析、可读性好</p>
<h3 id="Redis架构模式"><a href="#Redis架构模式" class="headerlink" title="Redis架构模式"></a>Redis架构模式</h3><p>1.单机<br>简单、容量有限、处理能力有限、无法高可用</p>
<p>2.主从复制Master-Slave<br>master/slave角色、master/slave数据同步、降低master读压力，没有解决master写压力</p>
<p>3.哨兵Sentinel<br>1、保证高可用<br>2、监控各个节点<br>3、自动故障迁移</p>
<blockquote>
<p>监控：Sentinel会不断检测主从服务器能否正常运行<br>提醒：Redis实例出现问题，Sentinel可以通过API向管理员或其他程序发通知<br>故障转移：实例不能正常工作时，Sentinel会开始自动故障转移</p>
</blockquote>
<p>4.集群（Proxy）</p>
<p><img src="https://img2018.cnblogs.com/blog/1481291/201809/1481291-20180925142206124-913246424.png" alt="avatar"></p>
<p>5.集群（直连）<br>1、无中心架构（不存在哪个节点影响性能瓶颈），少了 proxy 层。<br>2、数据按照 slot 存储分布在多个节点，节点间数据共享，可动态调整数据分布。<br>3、可扩展性，可线性扩展到 1000 个节点，节点可动态添加或删除。<br>4、高可用性，部分节点不可用时，集群仍可用。通过增加 Slave 做备份数据副本<br>5、实现故障自动 failover，节点之间通过 gossip 协议交换状态信息，用<strong>投票机制</strong>完成 Slave到 Master 的角色提升。</p>
<p><img src="https://img2018.cnblogs.com/blog/1481291/201809/1481291-20180925142304757-1498788186.png" alt="avatar"></p>
<h3 id="穿透和雪崩"><a href="#穿透和雪崩" class="headerlink" title="穿透和雪崩"></a>穿透和雪崩</h3><h4 id="穿透"><a href="#穿透" class="headerlink" title="穿透"></a>穿透</h4><blockquote>
<p>一般的缓存系统，都是按照key去缓存查询，如果不存在对应的value，就应该去后端系统查找（比如DB）。一些恶意的请求会故意查询不存在的key,请求量很大，就会对后端系统造成很大的压力。这就叫做缓存穿透<br>如何避免？<br>1：对查询结果为空的情况也进行缓存，缓存时间设置短一点，或者该key对应的数据insert了之后清理缓存<br>2：对一定不存在的key进行过滤。可以把所有的可能存在的key放到一个大的Bitmap中，查询时通过该bitmap过滤。</p>
</blockquote>
<h4 id="雪崩"><a href="#雪崩" class="headerlink" title="雪崩"></a>雪崩</h4><blockquote>
<p>当缓存服务器重启或者大量缓存集中在某一个时间段失效，这样在失效的时候，会给后端系统带来很大压力。导致系统崩溃。<br>如何避免？<br>1：在缓存失效后，通过加锁或者队列来控制读数据库写缓存的线程数量。比如对某个key只允许一个线程查询数据和写缓存，其他线程等待。<br>2：做二级缓存，A1为原始缓存，A2为拷贝缓存，A1失效时，可以访问A2，A1缓存失效时间设置为短期，A2设置为长期<br>3：不同的key，设置不同的过期时间，让缓存失效的时间点尽量均匀。</p>
</blockquote>
<h3 id="RESP协议"><a href="#RESP协议" class="headerlink" title="RESP协议"></a>RESP协议</h3><p>Redis的协议规范是 Redis Serialization Protocol (Redis序列化协议)<br>该协议是用于与Redis服务器通信的，用的较多的是Redis-cli通过pipe与Redis服务器联系；</p>
<blockquote>
<p>For Simple Strings the first byte of the reply is “+” 简单字符串<br>For Errors the first byte of the reply is “-“ 错误<br>For Integers the first byte of the reply is “:” 整数<br>For Bulk Strings the first byte of the reply is “$” 大字符串<br>For Arrays the first byte of the reply is “*” 数组</p>
</blockquote>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/事务/" rel="tag"># 事务</a>
          
            <a href="/blog/tags/分布式/" rel="tag"># 分布式</a>
          
            <a href="/blog/tags/缓存/" rel="tag"># 缓存</a>
          
            <a href="/blog/tags/CAP/" rel="tag"># CAP</a>
          
            <a href="/blog/tags/BASE/" rel="tag"># BASE</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div id="needsharebutton-postbottom">
            <span class="btn">
              <i class="fa fa-share-alt" aria-hidden="true"></i>
            </span>
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2019/03/16/设计模式复习/" rel="next" title="设计模式复习">
                <i class="fa fa-chevron-left"></i> 设计模式复习
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2019/03/22/数据结构复习/" rel="prev" title="数据结构复习">
                数据结构复习 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">JavaKK</p>
              <p class="site-description motion-element" itemprop="description">Be Better No Ego</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">28</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/blog/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blog/tags/index.html">
                  <span class="site-state-item-count">21</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/javakk" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:92920@sohu.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://www.javakk.cn" target="_blank" title="Resume">
                      
                        <i class="fa fa-fw fa-instagram"></i>Resume</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#CAP和BASE理论"><span class="nav-number">1.</span> <span class="nav-text">CAP和BASE理论</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#CAP"><span class="nav-number">1.1.</span> <span class="nav-text">CAP</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#BASE"><span class="nav-number">1.2.</span> <span class="nav-text">BASE</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SOA分布式事务解决方案"><span class="nav-number">2.</span> <span class="nav-text">SOA分布式事务解决方案</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#基于XA协议的两阶段提交方案"><span class="nav-number">2.1.</span> <span class="nav-text">基于XA协议的两阶段提交方案</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#TCC方案"><span class="nav-number">2.2.</span> <span class="nav-text">TCC方案</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#GTS–分布式事务解决方案"><span class="nav-number">2.3.</span> <span class="nav-text">GTS–分布式事务解决方案</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#性能超强"><span class="nav-number">2.3.1.</span> <span class="nav-text">性能超强</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#GTS对业务低侵入"><span class="nav-number">2.3.2.</span> <span class="nav-text">GTS对业务低侵入</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#完整解决方案"><span class="nav-number">2.3.3.</span> <span class="nav-text">完整解决方案</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#容错能力强"><span class="nav-number">2.3.4.</span> <span class="nav-text">容错能力强</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#LCN-SpringCloud"><span class="nav-number">2.4.</span> <span class="nav-text">LCN-SpringCloud</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Atomikos"><span class="nav-number">2.5.</span> <span class="nav-text">Atomikos</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#分布式缓存"><span class="nav-number">2.6.</span> <span class="nav-text">#分布式缓存</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Redis简介"><span class="nav-number">2.7.</span> <span class="nav-text">Redis简介</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#数据类型"><span class="nav-number">2.7.1.</span> <span class="nav-text">数据类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#主从复制"><span class="nav-number">2.7.2.</span> <span class="nav-text">主从复制</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#持久化"><span class="nav-number">2.7.3.</span> <span class="nav-text">持久化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Redis通信协议"><span class="nav-number">2.7.4.</span> <span class="nav-text">Redis通信协议</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Redis架构模式"><span class="nav-number">2.7.5.</span> <span class="nav-text">Redis架构模式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#穿透和雪崩"><span class="nav-number">2.7.6.</span> <span class="nav-text">穿透和雪崩</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#穿透"><span class="nav-number">2.7.6.1.</span> <span class="nav-text">穿透</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#雪崩"><span class="nav-number">2.7.6.2.</span> <span class="nav-text">雪崩</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#RESP协议"><span class="nav-number">2.7.7.</span> <span class="nav-text">RESP协议</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-snowflake-o"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Powered by JavaKK</span>

  
</div>









        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  
  
  <link rel="stylesheet" href="/blog/lib/needsharebutton/needsharebutton.css">

  
  
  <script src="/blog/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  

  

  

  

</body>
</html>
